﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SomeGame.Actors.Components {

    public class Appearance : ActorComponent {

        public Texture2D Texture;
        public Rectangle? Source;
        public Color Color;
        public float Rotation;
        public Vector2 Origin;
        public SpriteEffects SpriteEffects;

		public Appearance(Body body)
		    : this(body, null, null, Color.White, 0, Vector2.Zero){
		    // ...
		}

		public Appearance(Body body, Texture2D texture)
		    : this(body, texture, null, Color.White, 0, Vector2.Zero) {
		    // ...
		}

		public Appearance(Body body, Texture2D texture, Color color)
		    : this(body, texture, null, color, 0, Vector2.Zero){
		    // ...
		}

		public Appearance(Body body, Texture2D texture, Rectangle? source, Color color, float rotation)
		    : this(body, texture, source, color, rotation, new Vector2(texture.Width/2f, texture.Height/2f)){
		    // ...
		}

        private Appearance(Body body, Texture2D texture, Rectangle? source, Color color, float rotation, Vector2 origin) {
            Texture = texture;
            Source = source;
            Color = color;
            Rotation = rotation;
            Origin = origin;
	        SpriteEffects = body.FacingDirection == FacingDirection.Left ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
        }

    }

}